package com.qjdchina.sku.biz.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qjdchina.commons.result.Result;
import com.qjdchina.sku.biz.RoleManager;
import com.qjdchina.sku.dao.mapper.RoleMapper;
import com.qjdchina.sku.model.Role;
import com.qjdchina.sku.service.enums.SkuResultCode;

/**
 * 角色
 * @author shenpingfeng
 * 2017年2月14日
 */
@Service
public class RoleManagerImpl implements RoleManager {

	private static final Logger LOGGER = LoggerFactory.getLogger(RoleManagerImpl.class);

	@Autowired
	private RoleMapper roleMapper;
	/**
	 * 获取所有角色
	 * shenpingfeng
	 * 2017年2月14日
	 * @return
	 */
	@Override
	public Result<List<Role>> getAllRole() {
		List<Role> roles = roleMapper.selectAllRole();
		if(roles == null || roles.size() == 0){
			return new Result<List<Role>>(SkuResultCode.DATA_NOT_EXIST);
		}
		return new Result<List<Role>>(roles);
	}

}
